using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("VTemplateDevice", null, "Wicresoft.Messages.ConnectionString")]
	public class VTemplateDevice : ViewInfo
	{
		#region SQL column name consts 
		public const string SQLCOL_TEMPLATEID = "TemplateID";
		public const string SQLCOL_DEVICEID = "DeviceID";
		public const string SQLCOL_ISDEFAULT = "IsDefault";
		public const string SQLCOL_TEXTTEMPLATE = "TextTemplate";
		public const string SQLCOL_DEVICENAME = "DeviceName";
		public const string SQLCOL_DEVICEDISPLAYNAME = "DeviceDisplayName";
		public const string SQLCOL_ASSEMBLYNAME = "AssemblyName";
		public const string SQLCOL_INCOMINGCLASSNAME = "IncomingClassName";
		public const string SQLCOL_OUTGOINGCLASSNAME = "OutgoingClassName";
		public const string SQLCOL_USEPOOL = "UsePool";
		public const string SQLCOL_CONTACTCOLUMN = "ContactColumn";
		public const string SQLCOL_DESCRIPTION = "Description";
		public const string SQLCOL_TEMPLATENAME = "TemplateName";
		#endregion


		#region Contructors
		/// <summary>
		/// Construct empty entity
		/// </summary>
		public VTemplateDevice () {}

		#endregion

		public override void Init (DataRow row)
		{
			TemplateID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_TEMPLATEID]);
			DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
			IsDefault = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_ISDEFAULT]);
			TextTemplate = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEXTTEMPLATE]);
			DeviceName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DEVICENAME]);
			DeviceDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DEVICEDISPLAYNAME]);
			AssemblyName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ASSEMBLYNAME]);
			IncomingClassName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_INCOMINGCLASSNAME]);
			OutgoingClassName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_OUTGOINGCLASSNAME]);
			UsePool = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_USEPOOL]);
			ContactColumn = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CONTACTCOLUMN]);
			Description = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DESCRIPTION]);
			TemplateName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEMPLATENAME]);
		}

		#region Properties 
		#region Property <Guid> TemplateID
		[Property("TemplateID", 16, SqlDbType.UniqueIdentifier, false, false)]
		public Guid TemplateID 
		{
			get { return _TemplateID; }
			set { _TemplateID = value; }
		}
		private Guid _TemplateID = Guid.Empty;
		#endregion

		#region Property <int> DeviceID
		[Property("DeviceID", 4, SqlDbType.Int, false, false)]
		public int DeviceID 
		{
			get { return _DeviceID; }
			set { _DeviceID = value; }
		}
		private int _DeviceID = int.MinValue;
		#endregion

		#region Property <bool> IsDefault
		[Property("IsDefault", 1, SqlDbType.Bit, false, false)]
		public bool IsDefault 
		{
			get { return _IsDefault; }
			set { _IsDefault = value; }
		}
		private bool _IsDefault = false;
		#endregion

		#region Property <string> TextTemplate
		[Property("TextTemplate", 2147483646, SqlDbType.NText, false, false)]
		public string TextTemplate 
		{
			get { return _TextTemplate; }
			set { _TextTemplate = value; }
		}
		private string _TextTemplate = null;
		#endregion

		#region Property <string> DeviceName
		[Property("DeviceName", 100, SqlDbType.NVarChar, false, false)]
		public string DeviceName 
		{
			get { return _DeviceName; }
			set { _DeviceName = value; }
		}
		private string _DeviceName = null;
		#endregion

		#region Property <string> DeviceDisplayName
		[Property("DeviceDisplayName", 100, SqlDbType.NVarChar, false, false)]
		public string DeviceDisplayName 
		{
			get { return _DeviceDisplayName; }
			set { _DeviceDisplayName = value; }
		}
		private string _DeviceDisplayName = null;
		#endregion

		#region Property <string> AssemblyName
		[Property("AssemblyName", 400, SqlDbType.NVarChar, false, false)]
		public string AssemblyName 
		{
			get { return _AssemblyName; }
			set { _AssemblyName = value; }
		}
		private string _AssemblyName = null;
		#endregion

		#region Property <string> IncomingClassName
		[Property("IncomingClassName", 400, SqlDbType.NVarChar, false, false)]
		public string IncomingClassName 
		{
			get { return _IncomingClassName; }
			set { _IncomingClassName = value; }
		}
		private string _IncomingClassName = null;
		#endregion

		#region Property <string> OutgoingClassName
		[Property("OutgoingClassName", 400, SqlDbType.NVarChar, false, false)]
		public string OutgoingClassName 
		{
			get { return _OutgoingClassName; }
			set { _OutgoingClassName = value; }
		}
		private string _OutgoingClassName = null;
		#endregion

		#region Property <bool> UsePool
		[Property("UsePool", 1, SqlDbType.Bit, false, false)]
		public bool UsePool 
		{
			get { return _UsePool; }
			set { _UsePool = value; }
		}
		private bool _UsePool = false;
		#endregion

		#region Property <string> ContactColumn
		[Property("ContactColumn", 200, SqlDbType.NVarChar, false, false)]
		public string ContactColumn 
		{
			get { return _ContactColumn; }
			set { _ContactColumn = value; }
		}
		private string _ContactColumn = null;
		#endregion

		#region Property <string> Description
		[Property("Description", 2147483646, SqlDbType.NText, false, false)]
		public string Description 
		{
			get { return _Description; }
			set { _Description = value; }
		}
		private string _Description = null;
		#endregion

		#region Property <string> TemplateName
		[Property("TemplateName", 100, SqlDbType.NVarChar, false, false)]
		public string TemplateName 
		{
			get { return _TemplateName; }
			set { _TemplateName = value; }
		}
		private string _TemplateName = null;
		#endregion
		#endregion
	}
}
